﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;

/// <summary>
/// Summary description for clsCauHoi
/// </summary>
/// 

public class clsCauHoi:BLL
{
	DataClassesDataContext db = new DataClassesDataContext();
	public clsCauHoi()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    private string MaCH;

    public string MaCH1
    {
        get { return MaCH; }
        set { MaCH = value; }
    }
    private string NoidungCH;

    public string NoidungCH1
    {
        get { return NoidungCH; }
        set { NoidungCH = value; }
    }
    private string Da1;

    public string Da11
    {
        get { return Da1; }
        set { Da1 = value; }
    }
    private string Da2;

    public string Da21
    {
        get { return Da2; }
        set { Da2 = value; }
    }
    private string Da3;

    public string Da31
    {
        get { return Da3; }
        set { Da3 = value; }
    }
    private string Da4;

    public string Da41
    {
        get { return Da4; }
        set { Da4 = value; }
    }
    private string DaDung;

    public string DaDung1
    {
        get { return DaDung; }
        set { DaDung = value; }
    }
    private string Mucdo;

    public string Mucdo1
    {
        get { return Mucdo; }
        set { Mucdo = value; }
    }
    //[DataObjectMethod(DataObjectMethodType.Select, true)]
    //public List<CauHoi> laych()
    //{
    //    List<CauHoi> l = new List<CauHoi>();
    //    CauHoi ch = new CauHoi();

    //    ch.MaCH1 = "asd";
    //    l.Add(ch);
    //    return l;
    //}
    




    public void ThemCHmoi( string noidungch, string da1, string da2, string da3, string da4, string daDung, string dokho)
    {

        tbl_NGANHANGCAUHOI clsCH = new tbl_NGANHANGCAUHOI();

        int idmaxs = (int)db.sp_GetCurrentInd("tbl_NGANHANGCAUHOI").ReturnValue;

        string mach = TaoMaAuto("MaCH", "0000", idmaxs);

        clsCH.MaCH = mach;
        clsCH.NoiDungCH = noidungch;
        clsCH.DA1 = da1;
        clsCH.DA2 = da2;
        clsCH.DA3 = da3;
        clsCH.DA4 = da4;
        clsCH.DADUNG = daDung;
        clsCH.Mucdo = dokho;
        db.tbl_NGANHANGCAUHOIs.InsertOnSubmit(clsCH);
        db.SubmitChanges();

    }
    public void XoaCH(string mach)
    {
        var CHxoa = from p in db.tbl_NGANHANGCAUHOIs
                    where p.MaCH == mach
                    select p;
        db.tbl_NGANHANGCAUHOIs.DeleteAllOnSubmit(CHxoa);
        db.SubmitChanges();
    }
    //public void SuaCH(string noidungch, string da1, string da2, string da3, string da4, string daDung, string dokho)
    //{
    //    //CAUHOI clsCH = new CAUHOI();
    //    var CHsua = (from p in db.tbl_NGANHANGCAUHOIs
    //                 where p.MaCH == 
    //                 select p).Single();
    //    CHsua.NoiDungCH = noidungch;
    //    CHsua.DA1 = da1;
    //    CHsua.DA2 = da2;
    //    CHsua.DA3 = da3;
    //    CHsua.DA4 = da4;
    //    CHsua.DADUNG = daDung;
    //    CHsua.Mucdo = dokho;
    //    db.SubmitChanges();
    //}
}
